// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])

.constant('ApiEndpoint', {  
	url:'http://192.168.0.7:8080/tesis/'
})

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

  .state('app', {
    url: "/app",
    abstract: true,
    templateUrl: "templates/menu.html",
    controller: 'AppCtrl'
  })

  .state('app.search', {
    url: "/search",
    views: {
      'menuContent': {
        templateUrl: "templates/search.html"
      }
    }
  })

  .state('app.browse', {
    url: "/browse",
    views: {
      'menuContent': {
        templateUrl: "templates/browse.html"
      }
    }
  })
    .state('app.statementlist', {
      url: "/statementlist",
      views: {
        'menuContent': {
          templateUrl: "templates/statementlist.html",
          controller: 'StatementListCtrl'
        }
      }
    })

   
   .state('app.statemenListXGroup', {
    url: "/statementlist/:groupId",
    views: {
      'menuContent': {
        templateUrl: "templates/statementlist.html",
        controller: 'StatementXGroupCtrl'
      }
    }
  })
	
  .state('app.single', {  
    url: "/statement/:statementId",
	cache: false,
    views: {
      'menuContent': {
        templateUrl: "templates/statement.html",
        controller: 'StatementCtrl'
      }
    }
  })
  
  .state('app.substatement', {  
    url: "/substatement/:statementId",
	cache: false,
    views: {
      'menuContent': {
        templateUrl: "templates/statement.html",
        controller: 'StatementCtrl'
      }
    }
  })
  
  
  
  .state('app.statementcreate', {
      url: "/statementcreate",
      views: {
        'menuContent': {
          templateUrl: "templates/statementcreate.html",
		  controller: 'StatementCreateCtrl'
        }
      }
    })
  
  .state('app.substatementcreate', {
      url: "/substatementcreate/:statementParentId",
      views: {
        'menuContent': {
          templateUrl: "templates/statementExtensionCreate.html",
		  controller: 'StatementCreateExtensionCtrl'
        }
      }
    })
  
   .state('app.grouplist', {
    url: "/grouplist",
    views: {
      'menuContent': {
        templateUrl: "templates/grouplist.html",
        controller: 'GroupCtrl'
      }
    }
  })
  
  .state('app.attachmentviewer', {
    url: "/attachmentviewer/:statementId",
    views: {
      'menuContent': {
        templateUrl: "templates/attachmentViewer.html",
        controller: 'AttachmentViewerCtrl'
      }
    }
  })
  
  ;
  
  
  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/app/statementlist');
});
